<template>
  <view class="detail-modal">
    <up-popup v-model:show="show" overlay mode="bottom" touchable maxHeight="'80%'" closeable closeOnClickOverlay
      @close="close">
      <view class="modal-content">
        <view class="modal-header">
          <view class="modal-title">详细信息</view>
        </view>
        
        <view class="detail-info" v-if="rowData">
          <view class="info-item">
            <text class="label">设备编号SN：</text>
            <text class="value">{{ rowData.deviceSerial || '-' }}</text>
          </view>
          <view class="info-item">
            <text class="label">状态：</text>
            <text class="value">{{ rowData.bizStatus == 0 ? '违章' : '未违章' }}</text>
          </view>
          <view class="info-item">
            <text class="label">场地名称：</text>
            <text class="value">{{ rowData.veName || '-' }}</text>
          </view>
          <view class="info-item">
            <text class="label">来源：</text>
            <text class="value">{{ ['巡检人员', '客服人员', '高位视频桩', '巡检车'][rowData.inType] || '未知' }}</text>
          </view>
          <view class="info-item">
            <text class="label">泊位号：</text>
            <text class="value">{{ rowData.berthNumbers || '-' }}</text>
          </view>
          <view class="info-item">
            <text class="label">车牌号：</text>
            <text class="value">{{ rowData.carPlate || '-' }}</text>
          </view>
          <view class="info-item">
            <text class="label">创建时间：</text>
            <text class="value">{{ rowData.createTime || '-' }}</text>
          </view>
          <view class="info-item">
            <text class="label">更新时间：</text>
            <text class="value">{{ rowData.updateTime || '-' }}</text>
          </view>
          <view class="info-item">
            <text class="label">业务编码：</text>
            <text class="value">{{ rowData.bizCode || '-' }}</text>
          </view>
          <view class="info-item" v-if="rowData.dealRemark">
            <text class="label">处理备注：</text>
            <text class="value">{{ rowData.dealRemark }}</text>
          </view>
        </view>
      </view>

      <view class="modal-footer">
        <up-button type="primary" @click="close">关闭</up-button>
      </view>
    </up-popup>
  </view>
</template>

<script setup lang="ts">
import { ref } from 'vue';

const props = defineProps({
  rowData: {
    type: Object,
    default: () => ({}),
  },
});

const emit = defineEmits(["close"]);

defineOptions({
  name: "DetailModal",
});

const show = defineModel("show", { type: Boolean, default: false });

const close = () => {
  emit("close");
};
</script>

<style lang="scss" scoped>
.detail-modal {
  .modal-content {
    padding: 20rpx;
  }

  .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30rpx;

    .modal-title {
      font-size: 32rpx;
      font-weight: bold;
    }
  }

  .detail-info {
    .info-item {
      display: flex;
      margin-bottom: 20rpx;
      
      .label {
        width: 180rpx;
        color: #666;
        flex-shrink: 0;
      }
      
      .value {
        flex: 1;
        color: #333;
        word-break: break-all;
      }
    }
  }

  .modal-footer {
    padding: 20rpx;
    display: flex;
    justify-content: center;
  }
}
</style>